1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module soup.XMLRPCParams; 26 27 private import glib.ErrorG; 28 private import glib.GException; 29 private import glib.Str; 30 private import glib.Variant; 31 private import linker.Loader; 32 private import soup.c.functions; 33 public import soup.c.types; 34 35 36 /** 37 * Opaque structure containing XML-RPC methodCall parameter values. 38 * Can be parsed using soup_xmlrpc_params_parse() and freed with 39 * soup_xmlrpc_params_free(). 40 * 41 * Since: 2.52 42 */ 43 public class XMLRPCParams 44 { 45 /** the main Gtk struct */ 46 protected SoupXMLRPCParams* soupXMLRPCParams; 47 protected bool ownedRef; 48 49 /** Get the main Gtk struct */ 50 public SoupXMLRPCParams* getXMLRPCParamsStruct(bool transferOwnership = false) 51 { 52 if (transferOwnership) 53 ownedRef = false; 54 return soupXMLRPCParams; 55 } 56 57 /** the main Gtk struct as a void* */ 58 protected void* getStruct() 59 { 60 return cast(void*)soupXMLRPCParams; 61 } 62 63 /** 64 * Sets our main struct and passes it to the parent class. 65 */ 66 public this (SoupXMLRPCParams* soupXMLRPCParams, bool ownedRef = false) 67 { 68 this.soupXMLRPCParams = soupXMLRPCParams; 69 this.ownedRef = ownedRef; 70 } 71 72 ~this () 73 { 74 if ( Linker.isLoaded(LIBRARY_SOUP[0]) && ownedRef ) 75 soup_xmlrpc_params_free(soupXMLRPCParams); 76 } 77 78 79 /** 80 * Free a #SoupXMLRPCParams returned by soup_xmlrpc_parse_request(). 81 * 82 * Since: 2.52 83 */ 84 public void free() 85 { 86 soup_xmlrpc_params_free(soupXMLRPCParams); 87 ownedRef = false; 88 } 89 90 /** 91 * Parse method parameters returned by soup_xmlrpc_parse_request(). 92 * 93 * Deserialization details: 94 * - If @signature is provided, <int> and <i4> can be deserialized 95 * to byte, int16, uint16, int32, uint32, int64 or uint64. Otherwise 96 * it will be deserialized to int32. If the value is out of range 97 * for the target type it will return an error. 98 * - <struct> will be deserialized to "a{sv}". @signature could define 99 * another value type (e.g. "a{ss}"). 100 * - <array> will be deserialized to "av". @signature could define 101 * another element type (e.g. "as") or could be a tuple (e.g. "(ss)"). 102 * - <base64> will be deserialized to "ay". 103 * - <string> will be deserialized to "s". 104 * - <dateTime.iso8601> will be deserialized to an unspecified variant 105 * type. If @signature is provided it must have the generic "v" type, which 106 * means there is no guarantee that it's actually a datetime that has been 107 * received. soup_xmlrpc_variant_get_datetime() must be used to parse and 108 * type check this special variant. 109 * - @signature must not have maybes, otherwise an error is returned. 110 * - Dictionaries must have string keys, otherwise an error is returned. 111 * 112 * Params: 113 * signature = A valid #GVariant type string, or %NULL 114 * 115 * Returns: a new (non-floating) #GVariant, or %NULL 116 * 117 * Since: 2.52 118 * 119 * Throws: GException on failure. 120 */ 121 public Variant parse(string signature) 122 { 123 GError* err = null; 124 125 auto __p = soup_xmlrpc_params_parse(soupXMLRPCParams, Str.toStringz(signature), &err); 126 127 if (err !is null) 128 { 129 throw new GException( new ErrorG(err) ); 130 } 131 132 if(__p is null) 133 { 134 return null; 135 } 136 137 return new Variant(cast(GVariant*) __p, true); 138 } 139 }